#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iterator>
using namespace std;

map<string, int> record;
map<string, int>::iterator pos;
int main()
{
    int n, j;
    char ss[100];    
    char table[]="2223334445556667777888999";
    string in;
    in.reserve(10);
    scanf("%d", &n);
    while (n--)
    {
        scanf("%s", ss);     
        in = "";
        for (j=0; ss[j]!=0; ++j)
        {
            if (ss[j]>='A' && ss[j]<='Z') in += table[ss[j]-'A'];
            else if (ss[j]>='0' && ss[j]<='9') in += ss[j];
            if (in.size() == 3) in += '-';
        }    
        record[in]++;
    }    
    // output
    bool noout=true;
    for (pos=record.begin(); pos!=record.end(); ++pos)   
       if (pos->second > 1)    
           printf("%s %d\n", pos->first.c_str(), pos->second), noout=false;
    if (noout) printf("No duplicates.\n");
    return 0;    
}    